//
//  ViewController.swift
//  BTE
//
//  Created by 张文 on 2025/8/26.
//

import UIKit
import Alamofire
import SmartCodable





enum BTELunchNetTool_API: SERVER_NET_TYPE {
    
    case lunch(String,[String:String])
    case hosts
    
    var ROOT: String {
        switch self {
        case .lunch(let h,let dictionary):
            return h
        default:
            return ROOT_PATH
        }
    }
    
    
    var PATH: String {
        switch self {
        case .lunch(let h,let dictionary):
            return "/Blaugas/jeopardised"
        case .hosts:
            return ""
        }
    }
    
    
    var METHOD: SERVER_NET_F {
        switch self {
        case .lunch(let dictionary):
            return .GET
        case .hosts:
            return .GET
        }
    }
    
    
    var TASK: SERVER_TASK {
        switch self {
        case .lunch(let h,let dictionary):
            return .requestParameters(parameters:dictionary, encoding: URLEncoding.default)
        case .hosts:
            return .requestPlain
        }
    }
    
    
    var HEADER: [String : String]? {
        return nil
    }
    
}




class BTELunchNetServer: BTEServiceTool<BTELunchNetTool_API> {
 
    func lunch(host:String,data:[String:String],completion: @escaping (Result<NetBaseModel<BTELunchModel>?, NetError>) -> Void) {
        fetchData(target: BTELunchNetTool_API.lunch(host,data), resultClass: NetBaseModel<BTELunchModel>.self) { result in
            completion(result)
        }
    }
    
    func findhosturl(completion: @escaping(Result<NetBaseModel<[hostmodels]>?, NetError>) -> Void) {
        getsomejsonhost(target: BTELunchNetTool_API.hosts, responseClass: NetBaseModel<[hostmodels]>.self) { result in
            completion(result)
        }
    }
    
}







class BTELunchModel: SmartCodable {
    var unpernicious: Int = 1
    var subsale: BTELunchfacebookModel?
    var sacculated: String?
    required init(){}
}

class BTELunchfacebookModel: SmartCodable {
    var subvii: String?
       // CFBundleURLScheme
    var undonated: String?
       // FacebookAppID
    var palaeoglaciology: String?
       // FacebookDisplayName
    var vasovagal: String?
    required init(){}
}
